<template>
	<view>
		<!-- 选择栏 -->
		<view class="choose-tab flex relative" :style="[{top:0 + 'px'}]">
			<view :class="['tab-item flex-sub',checked == index ? 'active':'']" v-for="(item,index) in tabbar"
				:key="index" @click="chooseTab(index)">
				{{item.name}}
			</view>
		</view>

		<!-- 订单列表 -->
		<swiper class="grace-tab-swiper-full" :current="swiperCurrentIndex" @change="swiperChange"
			:style="{ height: tabHeight + 'px' }">
			<swiper-item v-for="(item, newsIndex) in tabbar.length" :key="newsIndex">
				<scroll-view :data-scindex="newsIndex" @scrolltolower="scrollBottom" scroll-y="true"
					:style="{ height: tabHeight + 'px' }">
					
					<view style="width:750rpx;height:116rpx;"></view>
					
						
						<view class="hot-goods flex justify-start align-center" v-for="(item,index) in 2" :key="index">
							<view class="goods-pic flex align-center justify-center">
								<image class="pic" mode="aspectFill" src="/static/test/rb.jpeg"></image>
							</view>
							<view class="goods-text relative">
								
								<view class="soltout">已售罄</view>
								
								<view class="text1 over-text2">
									这个是拼团商品的标题，需要测试一下长度之类的东西还有自提大小之类的
								</view>
								<view class="text2 flex align-center justify-between">
									<view class="item-time flex justify-start align-center">
										<image mode="aspectFill" class="w32 h32 img mr-8" src="/static/homePage/bangdan-check.png"></image>
										<text class="text">
											还剩25天21时32分42秒
										</text>
									</view>
									<text class="item2">
						
									</text>
								</view>
								<view class="btn flex align-center justify-between">
									<text class="item1">
										￥99
									</text>
									<view class="tab-text flex align-center justify-between">
										<view class="item1">
											剩余8件
										</view>
										<view class="item2 flex align-center justify-center">
											马上抢
											<image class="img" src="/static/store/jiantou.png"></image>
										</view>
									</view>
								</view>
							</view>
						</view>
						
						


				</scroll-view>
			</swiper-item>
		</swiper>



	</view>

</template>

<script>
	export default {
		data() {
			return {
				TabCur: undefined,
				swiperCurrentIndex: undefined,
				tabHeight: 466,


				checked: 0, //选中下标
				tabbar: [{
						id: 1,
						name: '全部'
					},
					{
						id: 2,
						name: '正在进行'
					},
					{
						id: 3,
						name: '即将开始'
					},
					{
						id: 4,
						name: '已售罄'
					}
				]


			}
		},
		computed: {
			style() {
				var StatusBar = this.StatusBar;
				var CustomBar = this.CustomBar;
				var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
				return style
			}
		},
		onLoad() {

		},
		onReady() {
			var that = this;
			//获取屏幕高度及比例
			var winInfo = uni.getSystemInfo({
				success: function(res) {
					var windowHeight = res.windowHeight;
					var dom = uni.createSelectorQuery().select('.choose-tab')
					dom.fields({
						size: true
					}, res => {
						if (!res) {
							return;
						}
						that.tabHeight = windowHeight;
					}).exec();
				}
			});
		},
		onShow() {



		},
		methods: {
			// srcoll到底了
			scrollBottom() {
				console.log('已经到底了=====')
			},
			// 轮播图滑动
			swiperChange(e) {
				var index = e.detail.current;
				this.checked = index;
				this.swiperCurrentIndex = index;
			},
			chooseTab(index) {
				this.checked = index;
				this.swiperCurrentIndex = index;
				console.log(this.checked, '===checked')
			},
			jump() {
				this.$mRouter.push({
					route: this.$mRoutesConfig.test.orderDetail,
					query: {
						a: 0
					}
				})
			},
			


		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f8f8f8;
	}
	
	.hot-goods {
		width: 750rpx;
		padding: 0 32rpx;
		margin-top: 16rpx;
		background-color: white;
	
		.goods-pic {
			width: 220rpx;
			height: 220rpx;
	
			.pic {
				width: 220rpx;
				height: 220rpx;
				border-radius: 16rpx;
			}
		}
	
		.goods-text {
			width: 466rpx;
			// height: 260rpx;
			padding-top: 20rpx;
			padding-left: 24rpx;
			
			.soltout{
				position: absolute;
				right:24rpx;
				top:32rpx;
				width:100rpx;
				height:100rpx;
				border-radius: 50%;
				background: #d4237a;
				color:white;
				line-height: 100rpx;
				text-align: center;
			}
	
			.text1 {
				width: 100%;
				height: 100rpx;
				line-height: 50rpx;
				font-size: 30rpx;
			}
	
			.text2 {
				width: 100%;
				height: 40rpx;
				line-height: 40rpx;
				.item-time{
					flex:5;
					.img{
						width:32rpx;
						height:32rpx;
					}
					color:#898c8c;
				}
	
				// padding:0 20rpx;
				text {
					display: inline-block;
					flex: 1;
					line-height: 40rpx;
				}
	
				.item1 {}
			}
			
			.btn{
				width:100%;
				height:80rpx;
				.item1 {
					text-align: right;
					font-size: 36rpx;
					color: #fc2b25;
					margin-right: 36rpx;
				}
				.btn-item{
					display: inline-block;
					width:120rpx;
					height:60rpx;
					background: #d4237a;
					color:white;
					line-height: 60rpx;
					text-align: center;
					
				}
				.tab-text{
					width:86%;
					height:60rpx;
					border:1rpx solid #ddd;
					border-radius: 16rpx;
					.item1{
						flex:1;
						text-align: center;
						font-size: 28rpx;
						color: gray;
					}
					.item2{
						width:160rpx;
						height:60rpx;
						background: #d4237a;
						color:white;
						border-radius: 16rpx;
						.img{
							width:28rpx;
							height:32rpx;
							margin-left:12rpx;
						}
					}
				}
			}
	
			.text3 {
				.tab-text {
					width: 80%;
					height: 60rpx;
					border: 1rpx solid #ddd;
					border-radius: 16rpx;
	
					.item1 {
						flex: 1;
						text-align: center;
						font-size: 24rpx;
						color: gray;
					}
	
					.item2 {
						width: 160rpx;
						height: 60rpx;
						background-color: pink;
						color: white;
						border-radius: 16rpx;
	
						.img {
							margin-left: 12rpx;
						}
					}
				}
	
				.icon {
					width: 60rpx;
					height: 60rpx;
					margin-left: 16rpx;
				}
	
			}
		}
	}
	
	
	
	.class-type{
		width:100%;
		padding-left: 30%;
	}

	.choose-tab {
		width: 750rpx;
		height: 116rpx;
		background-color: white;
		z-index: 9999;
		line-height: 116rpx;
		text-align: center;
		color: #999999;
		position: fixed;
		left: 0;

		.top-img {
			position: absolute;
			top: 0;
			left: 0;
		}

		.tab-item {
			position: relative;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			line-height: 116rpx;
			color: #999999;
		}

		.active {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			line-height: 116rpx;
			color: #DC2D20;
		}
	}
</style>
